home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / UTILITY / DO1002.ARJ / RETURNCD.SCR < prev    next >
Text File  |  1991-12-13  |  1KB  |  44 lines

  1. .pg wi full clr cy
  2.     COMMAND NAME»gray«: »%t« ReturnCode »ye«
  3.  
  4.     /RETURNCODE [{code}]
  5. /cw
  6.     Sets the »ye«code»#« returned to DOS when »%t«DO»#« exits.
  7.  
  8.     »cy«{code}»#« must be numeric.  The default return code is »ma«zero»#« ("0").
  9.     If »cy«{code}»#« is not included, the return code is set to »gr«zero»#«.
  10.  
  11.     The code can be tested with the DOS »wh«ERRORLEVEL»#« function.  Here is
  12.     an example of a »%t«DO»#« script and the BATch file which executes it:
  13.  
  14.     »gray«---- »ye«Start of script »gray«------------------------------------»cy«
  15.     * SCRIPT: HaltTest
  16.     /SET Default 0
  17.     /GETS Code Default "Return Code?" 2
  18.     /RETURNCODE %%Code
  19.     »gr«/HALT»gray«
  20.    ----  »ye«End of script»gray« --------------------------------------
  21. .pg
  22.    ----  »ye«Start of Batch File»gray« --------------------------------»cy«
  23.    @echo OFF
  24.    :TOP
  25.    »ye«do halttest»cy«
  26.    if »gr«ERRORLEVEL»cy« 2 GOTO R2
  27.    if »gr«ERRORLEVEL»cy« 1 GOTO R1
  28.    echo Returned ERRORLEVEL 0
  29.    GOTO End
  30.    :R2
  31.    echo Returned ERRORLEVEL 2 or higher
  32.    pause
  33.    GOTO Top
  34.    :R1
  35.    echo Returned ERRORLEVEL 1 or higher
  36.    pause
  37.    GOTO Top
  38.    :End
  39.    »gray«----  »ye«End of Batch File»gray« ----------------------------------»#«
  40.  
  41.    It is important to note that »cy«ERRORLEVEL»#« tests for the value or
  42.    »+re«HIGHER»#«.
  43. /ENDEXEC CLEAR
  44.